function shareAndRestore(obj, str1, str2) {
    if (!obj.onOff) {
        $(obj).addClass('ac');
        obj.onOff = true;
        var that = obj;
        var num = parseFloat($(obj).find('.num').text());
        layer.msg(str1, {
            icon: 6,
            time: 1000
        }, function () {
            $(that).html('<i class="ic"></i><span>' + str2 + '（<i class="num">' + (num + 1) + '</i>）</span>')
        })
    }
}

function shareAndRestore_2(obj, str1, str2) {
    if (!obj.onOff) {
        $(obj).addClass('ac');
        obj.onOff = true;
        var that = obj;
        layer.msg(str1, {
            icon: 6,
            time: 1000
        }, function () {
            $(that).html('已收藏');
        })
    }
}

$.validator.addMethod("mobile", function (value, element) {
    var reg = /^(((13[0-9]{1})|(15[0-9]{1})|(17[0-9]{1})|(18[0-9]{1}))+\d{8})$/;
    return this.optional(element) || reg.test(value);


}, "请输入正确手机号码");
$.validator.addMethod("qqCheck", function (value, element) {
    var reg = /[1-9][0-9]{4,}/;
    return this.optional(element) || reg.test(value);


}, "请输入正确qq号码");

$.validator.addMethod("pwMes", function (value, element) {
    var reg = /^(?![0-9]+$)(?![a-zA-Z]+$)[0-9A-Za-z]{10,10}$/;

    return this.optional(element) || reg.test(value);
}, "密码为10个字符，必须由字母跟数字组成");

$(function () {
    if (typeof getMyQueryString === "function" && getMyQueryString("mod" !== "forumdisplay")){
        //切换模块
        $(".menuTab").each(function () {
            $(this).find('.menu .item').each(function (index, ele) {
                $(this).on('click', function () {
                    $(this).addClass('ac').siblings().removeClass('ac');
                    $(this).parents('.menuTab').find('.content .common_item').hide();
                    $(this).parents('.menuTab').find('.content .common_item_' + (index + 1)).fadeIn();
                    $('.dot').each(function () {
                        $(this).dotdotdot({
                            wrap: 'letter',
                            after: 'a.readmore'
                        });
                    })

                });
            });
        });
        //返回顶部
        $('#gotoTop').on('click', function () {
            $('body,html').animate({scrollTop: 0}, 500);
        });

        //举报弹窗验证
        $('#jubaoForm').validate({
            rules: {
                jubaoContent: {
                    required: true,
                    maxlength: 200
                }
            }
        });
    }
})
$(function(){
	$('.face').click(function(){
		if(! $('#sinaEmotion').is(':visible')){  //这句不用管，有兴趣可以看js源代码里
			
			var facebox = $(this).parents(".artical_pinglun").find("textarea");  //定义facebox是用来装表情的div框框
			
			$(this).sinaEmotion(facebox);    //把表情放到上面定义的容器框框里
		}
	})
})
